package pri.hillchen.std.netty.timeserver.bio;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;


/**
 * @author:hillchen
 * @DESCRIPTION:
 * @Date: Created in 9:06 2018/3/30 0030.
 */
public class BioTimeServer  {
    public static void main(String[] args) throws IOException {
        final int port = 8080;
        ServerSocket serverSocket = null;
        try{
            serverSocket = new ServerSocket(port);
            System.out.println("time server start!");
            while (true){
                Socket socket = serverSocket.accept();
                new Thread(new TimeServerHandler(socket)).start();
            }
        }finally {
            if( serverSocket != null){
                serverSocket.close();
                serverSocket = null;
            }
        }


    }
}
